package com.wm.wmim.server.controller;



import com.wm.wmim.server.dto.bo.resp.ChatListRespBO;
import com.wm.wmim.server.dto.vo.resp.ChatListRespVO;
import com.wm.wmim.server.mapstruct.ChatListMapStruct;
import com.wm.wmim.server.service.ChatListService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * 聊天列表表(ChatList)表控制层
 *
 * @author weiming
 * @since 2025-02-20 23:25:56
 */
@RestController
@RequestMapping("chatList")
public class ChatListController {
    /**
     * 服务对象
     */
    @Resource
    private ChatListService chatListService;

    @Resource
    private ChatListMapStruct chatListMapStruct;

    @GetMapping("/list/{userId}")
    public List<ChatListRespVO> getChatList(@PathVariable("userId") Long userId){
        List<ChatListRespBO> respBOS = chatListService.listChat(userId);
        return chatListMapStruct.fromBOToVO(respBOS);
    }

}

